package cn.edu.gues.infosystam.mapper;

import cn.edu.gues.infosystam.entity.Template;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Select;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 苏小小
 * @since 2020-06-11
 */
public interface TemplateMapper extends BaseMapper<Template> {

    @Select("SELECT\n" +
            "\ttemplate.template_id,\n" +
            "\ttemplate.tno,\n" +
            "\ttemplate.template_name,\n" +
            "\ttemplate.template_fields,\n" +
            "\ttemplate.deleted,\n" +
            "\ttemplate.gmt_create,\n" +
            "\ttemplate.gmt_modified,\n" +
            "\tteacher.tname \n" +
            "FROM\n" +
            "\ttemplate\n" +
            "\tINNER JOIN teacher ON template.tno = teacher.tno \n" +
            "\tAND template.tno = #{tno}\n" +
            "\tAND template.deleted = 0\n" +
            "limit #{page}, #{size}")
    public List<Template> getAllTemplate(int page, int size, Integer tno);

}
